#pragma once
#define IntRef 0x40
//
//#define Pwm_Off {}
#define MosH_Off  { DDRD |= ((1 << DDD0) | (1 << DDD1) | (1 << DDD2)); }
#define MosH_A    { DDRD &= ~(1 << DDD0); }
#define MosH_B    { DDRD &= ~(1 << DDD1); }
#define MosH_C    { DDRD &= ~(1 << DDD2); }
#define MosL_Off  { PORTD &= ~((1 << PORTD3) | (1 << PORTD4) | (1 << PORTD5)); }
#define MosL_A    { PORTD |= (1 << PORTD3);}
#define MosL_B    { PORTD |= (1 << PORTD4);}
#define MosL_C    { PORTD |= (1 << PORTD5);}
//sener
#define Senser_A  {ADMUX = 0 | IntRef;}
#define Senser_B  {ADMUX = 1 | IntRef;}
#define Senser_C  {ADMUX = 2 | IntRef;}
#define Senser_X  (ACSR&(1<<ACO))
#define Senser_H  {SenserVal = (1 << ACO);}
#define Senser_L  {SenserVal = 0;}
//
#define Pash_AB 1
#define Pash_AC 2
#define Pash_BC 3
#define Pash_BA 4
#define Pash_CA 5
#define Pash_CB 6
//
extern unsigned short MotorSwitchCnt;
extern unsigned char MotorPashNum;
//
void Motor_Init(void);
void SetPwm(unsigned short Pwm);
void SwitchPash(unsigned char PashNum);
void SleepMs(unsigned short ms);
void Motor_Stop(void);
void Motor_Start(void);
